package com.example.demo.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.Entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from user where username=#{username}")
    public User FindUserByName(String username);

    @Insert("insert into user(username,password)"+
            "values (#{username},#{password})")
    public  void add(String username, String password);

    @Select("select password from user where username =#{username}")
    public String FindPasswordByName(String username);

    @Update("update user set password =#{newPassword} where username =#{username}")
    public void updatePWD(String newPassword, String username);

}
